package com.wocao.mapper;

import com.wocao.entity.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 菜单权限表 Mapper 接口
 */
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    //查询所有菜单及子菜单
    List<SysMenu> selectAllMenuAndChildMenu();

    //根据父类id查询
    @Select("select * from sys_menu where parent_id = #{id}")
    List<SysMenu> selectMenuByParentId(long id);

    /**
     * 查询全部以及侧边菜单
     *
     * @return
     */
    List<SysMenu> selectMenuWithChildren();

    /**
     * 菜单管理树状结构
     */
    List<SysMenu> selectMenuTree(@Param("menuName") String menuName, @Param("status") String status);

    /**
     * 根据用户id查询菜单
     *
     * @param userId
     * @return
     */
    List<SysMenu> selectMenusByUserId(Long userId);


}
